package org.LZQ.ShortLink.project.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import org.LZQ.ShortLink.project.domain.ShortLink;
import org.LZQ.ShortLink.project.dto.biz.ShortLinkStatsRecordDTO;
import org.LZQ.ShortLink.project.dto.req.ShortLinkBatchCreateReqDTO;
import org.LZQ.ShortLink.project.dto.req.ShortLinkCreateReqDTO;
import org.LZQ.ShortLink.project.dto.req.ShortLinkPageReqDTO;
import org.LZQ.ShortLink.project.dto.req.ShortLinkUpdateReqDTO;
import org.LZQ.ShortLink.project.dto.resp.ShortLinkBatchCreateRespDTO;
import org.LZQ.ShortLink.project.dto.resp.ShortLinkCreateRespDTO;
import org.LZQ.ShortLink.project.dto.resp.ShortLinkGroupCountQueryRespDTO;
import org.LZQ.ShortLink.project.dto.resp.ShortLinkPageRespDTO;

import java.io.IOException;
import java.util.List;

/**
* @description 针对表【t_link】的数据库操作Service
* @createDate 2024-08-21 22:24:35
*/
public interface ShortLinkService extends IService<ShortLink> {

    /**
     * 创建短链接
     * @param requestParam
     * @return
     */
    ShortLinkCreateRespDTO createShortLink(ShortLinkCreateReqDTO requestParam);

    void shortLinkStats(ShortLinkStatsRecordDTO statsRecord);

    /**
     * 查询短链接分组内数量
     * @param requestParam
     * @return
     */
    List<ShortLinkGroupCountQueryRespDTO> listGroupShortLinkCount(List<String> requestParam);

    /**
     * 分页查询短链接
     * @param requestParam
     * @return
     */
    IPage<ShortLinkPageRespDTO> pageShortLink(ShortLinkPageReqDTO requestParam);

    /**
     * 更新短连接信息
     * @param requestParam
     */
    void updateShortLink(ShortLinkUpdateReqDTO requestParam);

    ShortLinkCreateRespDTO createShortLinkByLock(ShortLinkCreateReqDTO requestParam);

    /**
     * 短链接跳转
     *
     * @param shortUri 短链接后缀
     * @param request  HTTP 请求
     * @param response HTTP 响应
     */
    void restoreUrl(String shortUri, ServletRequest request, ServletResponse response) throws IOException;

    ShortLinkBatchCreateRespDTO batchCreateShortLink(ShortLinkBatchCreateReqDTO requestParam);
}
